// wine.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUrls: [
      'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    showSteps: false,//是否显示关注公众号的引导页
    class_list:[
      {
        name:'全部分类',
        url: 'http://img5.imgtn.bdimg.com/it/u=3208813293,2228218644&fm=26&gp=0.jpg'
      },
      {
        name: '白葡萄酒',
        url: 'http://img5.imgtn.bdimg.com/it/u=3208813293,2228218644&fm=26&gp=0.jpg'
      },
      {
        name: '红葡萄酒',
        url: 'http://img5.imgtn.bdimg.com/it/u=3208813293,2228218644&fm=26&gp=0.jpg'
      },
      {
        name: '洋酒',
        url: 'http://img5.imgtn.bdimg.com/it/u=3208813293,2228218644&fm=26&gp=0.jpg'
      }
    ],
    banner:'http://f11.baidu.com/it/u=3546629856,1036016720&fm=72',
    seckill:'http://img1.imgtn.bdimg.com/it/u=2404339222,930765555&fm=26&gp=0.jpg',
    goods:[
      {
        url:'http://img0.imgtn.bdimg.com/it/u=3053470856,630083188&fm=26&gp=0.jpg',
        title:'AOP干红葡萄酒Frank推荐 44年老藤 雕花瓶红酒 750ml',
        price:'998',
        sales:'88',
        evaluate:'36'
      },
      {
        url: 'http://img4.imgtn.bdimg.com/it/u=3772737842,2069454972&fm=26&gp=0.jpg',
        title: 'AOP干红葡萄酒Frank推荐 44年老藤 雕花瓶红酒 750ml',
        price: '998',
        sales: '88',
        evaluate: '36'
      },
      {
        url: 'http://img4.imgtn.bdimg.com/it/u=1055718597,3240192701&fm=26&gp=0.jpg',
        title: 'AOP干红葡萄酒Frank推荐 44年老藤 雕花瓶红酒 750ml',
        price: '998',
        sales: '88',
        evaluate: '36'
      },
      {
        url: 'http://img5.imgtn.bdimg.com/it/u=3320861683,3400464644&fm=26&gp=0.jpg',
        title: 'AOP干红葡萄酒Frank推荐 44年老藤 雕花瓶红酒 750ml',
        price: '998',
        sales: '88',
        evaluate: '36'
      }
    ]
  },
  search(){
    wx.navigateTo({
      url: '../index/search',
    })
  },
  getData() {
    wx.showLoading({
      title: '正在加载...',
      mask: true
    })
    let baseUrl = getApp().globalData.baseUrl,
      access_token = getApp().globalData.access_token,
      self = this
    wx.request({
      url: baseUrl + '/Index/index',
      method: 'get',
      data: { access_token },
      success: data => {
        wx.hideLoading()
        console.log(data.data.code);
        console.log(data.data.data);
        if (data.data.code == 200){
          self.setData({ data: data.data.data })

        }
      }
    })
  },
  
  onLoad() {
    this.getData()
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    this.getData();
    wx.stopPullDownRefresh();
  },
  showConcernUs() {
    this.setData({
      showSteps: true
    })
  },
  closeConcernUs() {
    this.setData({
      showSteps: false
    })
  },
})